home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Include / Devices / Serial.i < prev    next >
Text File  |  1997-05-06  |  8KB  |  179 lines

  1. {
  2.         Serial.i for PCQ Pascal
  3.  
  4.         external declarations for the serial device
  5. }
  6.  
  7.  
  8. {$I "Include:Exec/IO.i"}
  9.  
  10. Type
  11.  
  12.                    { array of termination char's }
  13.                    { to use,see serial.doc setparams }
  14.  
  15.     IOTArray = record
  16.         TermArray0 : Integer;
  17.         TermArray1 : Integer;
  18.     end;
  19.     IOTArrayPtr = ^IOTArray;
  20.  
  21. Const
  22.  
  23.     SER_DEFAULT_CTLCHAR = $11130000;    { default chars for xON,xOFF }
  24.  
  25. { You may change these via SETPARAMS.   At this time, parity is not
  26.    calculated for xON/xOFF characters.  You must supply them with the
  27.    desired parity. }
  28.  
  29. {****************************************************************}
  30. { CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
  31.    IOExtSer-sized structure or you may overlay innocent memory !! }
  32. {****************************************************************}
  33.  
  34. Type
  35.  
  36.     IOExtSer = record
  37.         IOSer   : IOStdReq;
  38.  
  39. {     STRUCT    MsgNode
  40. *   0   APTR     Succ
  41. *   4   APTR     Pred
  42. *   8   UBYTE    Type
  43. *   9   UBYTE    Pri
  44. *   A   APTR     Name
  45. *   E   APTR     ReplyPort
  46. *  12   UWORD    MNLength
  47. *     STRUCT   IOExt
  48. *  14   APTR     io_Device
  49. *  18   APTR     io_Unit
  50. *  1C   UWORD    io_Command
  51. *  1E   UBYTE    io_Flags
  52. *  1F   UBYTE    io_Error
  53. *     STRUCT   IOStdExt
  54. *  20   ULONG    io_Actual
  55. *  24   ULONG    io_Length
  56. *  28   APTR     io_Data
  57. *  2C   ULONG    io_Offset
  58. *
  59. *  30 }
  60.  
  61.         io_CtlChar      : Integer; { control char's (order = xON,xOFF,INQ,ACK) }
  62.         io_RBufLen      : Integer; { length in bytes of serial port's read buffer }
  63.         io_ExtFlags     : Integer; { additional serial flags (see bitdefs below) }
  64.         io_Baud         : Integer; { baud rate requested (true baud) }
  65.         io_BrkTime      : Integer; { duration of break signal in MICROseconds }
  66.         io_TermArray    : IOTArray; { termination character array }
  67.         io_ReadLen      : Byte;   { bits per read character (# of bits) }
  68.         io_WriteLen     : Byte;   { bits per write character (# of bits) }
  69.         io_StopBits     : Byte;   { stopbits for read (# of bits) }
  70.         io_SerFlags     : Byte;   { see SerFlags bit definitions below   }
  71.         io_Status       : Short;
  72.     end;
  73.     IOExtSerPtr = ^IOExtSer;
  74.  
  75.    { status of serial port, as follows:
  76. *                  BIT  ACTIVE  FUNCTION
  77. *                   0    ---    reserved
  78. *                   1    ---    reserved
  79. *                   2    high   Connected to parallel "select" on the A1000.
  80. *                               Connected to both the parallel "select" and
  81. *                               serial "ring indicator" pins on the A500 &
  82. *                               A2000.  Take care when making cables.
  83. *                   3    low    Data Set Ready
  84. *                   4    low    Clear To Send
  85. *                   5    low    Carrier Detect
  86. *                   6    low    Ready To Send
  87. *                   7    low    Data Terminal Ready
  88. *                   8    high   read overrun
  89. *                   9    high   break sent
  90. *                  10    high   break received
  91. *                  11    high   transmit x-OFFed
  92. *                  12    high   receive x-OFFed
  93. *               13-15           reserved
  94. }
  95.  
  96. Const
  97.  
  98.     SDCMD_QUERY         = CMD_NONSTD;
  99.     SDCMD_BREAK         = CMD_NONSTD + 1;
  100.     SDCMD_SETPARAMS     = CMD_NONSTD + 2;
  101.  
  102.  
  103.     SERB_XDISABLED      = 7;    { io_SerFlags xOn-xOff feature disabled bit }
  104.     SERF_XDISABLED      = 128;  {    "      xOn-xOff feature disabled mask }
  105.     SERB_EOFMODE        = 6;    {    "      EOF mode enabled bit }
  106.     SERF_EOFMODE        = 64;   {    "      EOF mode enabled mask }
  107.     SERB_SHARED         = 5;    {    "      non-exclusive access bit }
  108.     SERF_SHARED         = 32;   {    "      non-exclusive access mask }
  109.     SERB_RAD_BOOGIE     = 4;    {    "      high-speed mode active bit }
  110.     SERF_RAD_BOOGIE     = 16;   {    "      high-speed mode active mask }
  111.     SERB_QUEUEDBRK      = 3;    {    "      queue this Break ioRqst }
  112.     SERF_QUEUEDBRK      = 8;    {    "      queue this Break ioRqst }
  113.     SERB_7WIRE          = 2;    {    "      RS232 7-wire protocol }
  114.     SERF_7WIRE          = 4;    {    "      RS232 7-wire protocol }
  115.     SERB_PARTY_ODD      = 1;    {    "      parity feature enabled bit }
  116.     SERF_PARTY_ODD      = 2;    {    "      parity feature enabled mask }
  117.     SERB_PARTY_ON       = 0;    {    "      parity-enabled bit }
  118.     SERF_PARTY_ON       = 1;    {    "      parity-enabled mask }
  119.  
  120. { These now refect the actual bit positions in the io_Status UWORD }
  121.  
  122.     IO_STATB_XOFFREAD   = 12;      { io_Status receive currently xOFF'ed bit }
  123.     IO_STATF_XOFFREAD   = $1000;   {     "     receive currently xOFF'ed mask }
  124.     IO_STATB_XOFFWRITE  = 11;      {     "     transmit currently xOFF'ed bit }
  125.     IO_STATF_XOFFWRITE  = $0800;   {     "     transmit currently xOFF'ed mask }
  126.     IO_STATB_READBREAK  = 10;      {     "     break was latest input bit }
  127.     IO_STATF_READBREAK  = $0400;   {     "     break was latest input mask }
  128.     IO_STATB_WROTEBREAK = 9;       {     "     break was latest output bit }
  129.     IO_STATF_WROTEBREAK = $0200;   {     "     break was latest output mask }
  130.     IO_STATB_OVERRUN    = 8;       {     "     status word RBF overrun bit }
  131.     IO_STATF_OVERRUN    = $0100;   {     "     status word RBF overrun mask }
  132.  
  133.  
  134.     SEXTB_MSPON         = 1;    { io_ExtFlags. Use mark-space parity, }
  135.                                 {           instead of odd-even. }
  136.     SEXTF_MSPON         = 2;    {    "      mark-space parity mask }
  137.     SEXTB_MARK          = 0;    {    "      if mark-space, use mark }
  138.     SEXTF_MARK          = 1;    {    "      if mark-space, use mark mask }
  139.  
  140.  
  141.     SerErr_DevBusy      = 1;
  142.     SerErr_BaudMismatch = 2;    { baud rate not supported by hardware }
  143.     SerErr_BufErr       = 4;    { Failed to allocate new read buffer }
  144.     SerErr_InvParam     = 5;
  145.     SerErr_LineErr      = 6;
  146.     SerErr_ParityErr    = 9;
  147.     SerErr_TimerErr     = 11;   {(See the serial/OpenDevice autodoc)}
  148.     SerErr_BufOverflow  = 12;
  149.     SerErr_NoDSR        = 13;
  150.     SerErr_DetectedBreak = 15;
  151.  
  152.  
  153. { These defines refer to the HIGH ORDER byte of io_Status.  They have
  154.    been replaced by the new, corrected ones above }
  155.     IOSTB_XOFFREAD  = 4;       { iost_hob receive currently xOFF'ed bit }
  156.     IOSTF_XOFFREAD  = 16;      {    "     receive currently xOFF'ed mask }
  157.     IOSTB_XOFFWRITE = 3;       {    "     transmit currently xOFF'ed bit }
  158.     IOSTF_XOFFWRITE = 8;       {    "     transmit currently xOFF'ed mask }
  159.     IOSTB_READBREAK = 2;       {    "     break was latest input bit }
  160.     IOSTF_READBREAK = 4;       {    "     break was latest input mask }
  161.     IOSTB_WROTEBREAK= 1;       {    "     break was latest output bit }
  162.     IOSTF_WROTEBREAK= 2;       {    "     break was latest output mask }
  163.     IOSTB_OVERRUN   = 0;       {    "     status word RBF overrun bit }
  164.     IOSTF_OVERRUN   = 1;       {    "     status word RBF overrun mask }
  165.  
  166.     IOSERB_BUFRREAD = 7  ;     { io_Flags from read buffer bit }
  167.     IOSERF_BUFRREAD = 128;  {    "     from read buffer mask }
  168.     IOSERB_QUEUED   = 6  ;     {    "     rqst-queued bit }
  169.     IOSERF_QUEUED   = 64 ; {    "     rqst-queued mask }
  170.     IOSERB_ABORT    = 5  ;     {    "     rqst-aborted bit }
  171.     IOSERF_ABORT    = 32 ; {    "     rqst-aborted mask }
  172.     IOSERB_ACTIVE   = 4  ;     {    "     rqst-qued-OR-current bit }
  173.     IOSERF_ACTIVE   = 16 ; {    "     rqst-qued-OR-current mask }
  174.  
  175.  
  176.  
  177.     SERIALNAME          = "serial.device";
  178.  
  179.